I analyze optimal loan modification schemes in a stochastic home price and stochastic interest-rate environment. Lenders maximize loan values by managing the borrower’s option to default on the loan and prepayment option. Given negative equity, controlling for the borrower’s ability to pay, rate reductions and maturity extensions result in a higher probability of redefault by homeowners even after modification of their loans. In contrast, loan write-downs (the Principal Principle), not a favored recipe, are value maximizing for the lender. A shared-appreciation mortgage enhances the ability to pay, mitigates adverse selection, and reduces the present value of expected deadweight foreclosure costs.